/*
 * Prints leap years in a given range
 * Copyright (C) 2011  Ruslan Mikhaylenko
 */

#include <stdio.h>
#include <stdlib.h>


int main(int argc, char **argv) {
	int start_year, end_year;
	if(argc == 1) {
		start_year = 1582;
		end_year =2024;
	} else	
	if(argc != 3) {
		fprintf(stderr, "Usage: %s start_year end_year\n", argv[0]);
		exit(1);
	} else {
		start_year = atoi(argv[1]);
		end_year = atoi(argv[2]);
	}

	printf("Year range: from %d to %d\n", start_year, end_year);
	
	for(int i=start_year; i<=end_year; i++) {
		if( (((i%4) == 0) && ((i%100) != 0)) || ((i%400) == 0) )	
	printf("%d\n", i);
	}
	return 0;
}
